<%--
  Created by IntelliJ IDEA.
  User: Lenovo
  Date: 2025/5/4
  Time: 16:45
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page import="com.project.DB_Flight" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%
  String starttime = request.getParameter("starttimeYear") + "-" +
          request.getParameter("starttimeMonth") + "-" +
          request.getParameter("starttimeDay") + " " +
          request.getParameter("starttimeHour") + ":" +
          request.getParameter("starttimeMinute") + ":" +
          request.getParameter("starttimeSecond");

  String endtime = request.getParameter("endtimeYear") + "-" +
          request.getParameter("endtimeMonth") + "-" +
          request.getParameter("endtimeDay") + " " +
          request.getParameter("endtimeHour") + ":" +
          request.getParameter("endtimeMinute") + ":" +
          request.getParameter("endtimeSecond");

  String takeoffstation = request.getParameter("takeoffstation");
  String arrivalstation = request.getParameter("arrivalstation");

  String boardingtime = request.getParameter("boardingtimeYear") + "-" +
          request.getParameter("boardingtimeMonth") + "-" +
          request.getParameter("boardingtimeDay") + " " +
          request.getParameter("boardingtimeHour") + ":" +
          request.getParameter("boardingtimeMinute") + ":" +
          request.getParameter("boardingtimeSecond");

  List<String> addInput = new ArrayList<>();
  addInput.add(starttime);
  addInput.add(endtime);
  addInput.add(takeoffstation);
  addInput.add(arrivalstation);
  addInput.add(boardingtime);

  DB_Flight dbFlight = new DB_Flight();
  boolean addResult = dbFlight.add(addInput);

  if (addResult) {
    response.sendRedirect("index.jsp");
  } else {
    out.println("添加航班失败");
  }
%>